package com.game.backend.service.impl.rank;

import com.alibaba.fastjson2.JSONObject;
import com.game.backend.mapper.RecordMapper;
import com.game.backend.mapper.UserMapper;
import com.game.backend.model.RankUser;
import com.game.backend.service.rank.RankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class RankServiceImpl implements RankService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public JSONObject getList(Integer page) {
        Integer size = 10;
        Integer st = (page-1)*size;
        JSONObject jsonObject = new JSONObject();
        List<RankUser> items = userMapper.getRankList(st,size);
        Integer usersCount = userMapper.getCount();
        jsonObject.put("rankedusers",items);
        jsonObject.put("userscount",usersCount);
        return jsonObject;
    }
}
